<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Sky Garden</title>

    </head>
    <body>
        <div class="widget">
            <h2> Log in/Register</h2>
            <div class="inner">
                <form action="login_gd.php" method="POST">
                    <ul id="login">
                        <li>
                            Username: <br>
                            <input type="text" name="username">
                        </li>
                        <li>
                            Password: <br>
                            <input type="password" name="password">
                        </li>
                        <li>
                            <input type="submit" value="Log in">
                        </li>
                        <li>
                            <a href="register.php">Register</a>
                        </li>
                        <ul>
                            </form>

                            <?php
                            
                            if (empty($_POST) === false) {
                                $username = $_POST['username'];
                                $password = $_POST['password'];
                                echo $username, ' ', $password;
                                if (empty($username) === true || empty($password) === true) {
                                    $errors = 'You need to enter a username and password';
                                } else if (user_exists($username) === false) {
                                    $errors = 'We can\'t find username and password';
                                } else if (user_active($username) === false) {
                                    $errors = 'You haven\'t activated your account';
                                } else {
                                    
                                }
                                echo $errors;
                            }
                            ?>

                            </div>
                            </div>
                            </body>
                            </html>